import java.util.ArrayList;
import java.util.Iterator;


public class Observable implements QuackObservable {
	ArrayList observers = new ArrayList();
	QuackObservable duck;
	
	public Observable(QuackObservable duck) {
		this.duck = duck;
	}
	
	@Override
	public void registerObserver(Observer observer) {
		observers.add(observer);
	}
	
	@Override
	public void notifyObservers() {
		Iterator i = observers.iterator();
		while (i.hasNext()) {
			Observer observer = (Observer)i.next();
			observer.update(duck);
		}

	}

}
